window.addEventListener('load',function() {
    var swiperBtnr = document.querySelector('.swiper-button-next')
    var swiperBtnl = document.querySelector('.swiper-button-prev')
    var Myswiper = document.querySelector('.swiper')
    var swiper = new Swiper(".mySwiper", {
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: {
          delay: 3000,
          disableOnInteraction: false,
        },
        pagination: {
          el: ".swiper-pagination",
          clickable: true,
        },
        navigation: {
          nextEl: ".swiper-button-next",
          prevEl: ".swiper-button-prev",
        },
        loop:true,
        keyboard : true,
        effect: 'fade',
      });
      // 当鼠标经过swiper时  左右箭头就显示出来，当鼠标离开后，左右箭头隐藏
      Myswiper.addEventListener('mouseenter', function() {
        swiperBtnr.style.display = 'block'
        swiperBtnl.style.display = 'block'
      })
      Myswiper.addEventListener('mouseleave',function() {
        swiperBtnr.style.display = 'none'
        swiperBtnl.style.display = 'none'
      })
})